package org.jeecg.modules.ywSemiFinishedProductBasic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.constant.CommonConstant;
import org.jeecg.modules.ywSemiFinishedProductBasic.entity.YwSemiFinishedProductInfo;
import org.jeecg.modules.ywSemiFinishedProductBasic.mapper.YwSemiFinishedProductInfoMapper;
import org.jeecg.modules.ywSemiFinishedProductBasic.service.IYwSemiFinishedProductInfoService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 半成品信息表
 * @Author: jeecg-boot
 * @Date: 2024-08-14
 * @Version: V1.0
 */
@Service
public class YwSemiFinishedProductInfoServiceImpl extends ServiceImpl<YwSemiFinishedProductInfoMapper, YwSemiFinishedProductInfo> implements IYwSemiFinishedProductInfoService {

    @Resource
    private YwSemiFinishedProductInfoMapper ywSemiFinishedProductInfoMapper;

    @Override
    public Result<?> queryProjectList(String deptName, String productCode) {
        QueryWrapper<YwSemiFinishedProductInfo> queryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank(deptName)) {
            queryWrapper.eq("dept_name", deptName);
        }
        if (StringUtils.isNotBlank(productCode)) {
            queryWrapper.eq("product_code", productCode);
        }
        queryWrapper.eq("status", CommonConstant.StatusEnum.YES.getCode());
        List<YwSemiFinishedProductInfo> list = ywSemiFinishedProductInfoMapper.selectList(queryWrapper);
        return Result.OK(list);
    }

}
